package com.cogent.report.display.impl;

import java.util.HashMap;

import com.cogent.common.date.JodaDateUtil;
import com.cogent.common.util.MapUtil;
import com.cogent.report.display.IReportDisplay;
import com.cogent.report.domain.ReportDisplayFieldDomain;

public class AgeDisplayImpl implements IReportDisplay {	
	public String getDisplayValue(ReportDisplayFieldDomain displayFieldDomain, HashMap dataMap) {
		if(MapUtil.isEmpty(dataMap, displayFieldDomain.getTypecode()))
			return "";
		String orgindate = MapUtil.getShortDate(dataMap, displayFieldDomain.getTypecode());		
		int curyear = JodaDateUtil.getCurYear() + 1;
		int orginyear = JodaDateUtil.getYear(JodaDateUtil.stringToDate(orgindate));
		String ret = "" + (curyear - orginyear);
		
		return ret;
	}
}
